package com.springboot.frame.sms;

/**
 * @author liheng
 * @ClassName SmsSenderService
 * @Description
 * @date 2021-03-12 18:54
 */
public class SmsSenderService implements SmsSender {

    private TrenchType trenchType;
    /**
     * ak
     */
    private String accessKeyId;
    /**
     * ak
     */
    private String accessKeySecret;
    /**
     * 短信签名
     */
    private String signName;


    /**
     * 基础数据构造
     *
     * @param accessKeyId
     * @param accessKeySecret
     * @param trenchType
     * @param signName
     */
    public SmsSenderService(String accessKeyId, String accessKeySecret, TrenchType trenchType, String signName) {
        this.accessKeyId = accessKeyId;
        this.accessKeySecret = accessKeySecret;
        this.signName = signName;
        this.trenchType = trenchType;
    }

    @Override
    public String send(String templateCode, String phoneNumbers, String templateParam) {
        return send(templateCode, phoneNumbers, templateParam, null);
    }

    @Override
    public String send(String templateCode, String phoneNumbers, String templateParam, String outId) {
        if (TrenchType.ALIYUN.equals(this.trenchType)) {
            // 阿里云发送
            return SmsSendUtils.aliyunSmsSend(this.accessKeyId, this.accessKeySecret, outId, this.signName, templateCode, templateParam, phoneNumbers);
        } else {

        }
        return null;
    }
}
